<template>
	<view class='withdrawal_details'>
		<!--  -->
		<view class="no_html" v-if="list.length==0">
			<image src="@/static/images/no_img7.png" mode=""></image>
			<text>暂无提现记录</text>
		</view>
		<view v-else>
			<view class="list" v-for="(item,index) in list" :key="index">
				<view class="title">
					<view class="left">{{item.createtime}}</view>
					<view class="right">
						<text class="color1" v-if="item.status==1">待审核</text>
						<text class="color2" v-if="item.status==2">审核通过</text>
						<text class="color3" v-if="item.status==3">审核驳回</text>
					</view>
				</view>
				<view class="text" v-if="item.user">
					<view class="txt" style="width: 100%;">提现金额：<text style="color: #F56C6C;">￥{{item.money}}</text></view>
					<view class="txt" style="width: 100%;" v-if="item.audittime">审核时间：{{item.audittime}}</view>
					<view class="txt" style="width: 100%;" v-if="item.refuse_msg">驳回理由：{{item.refuse_msg}}</view>
				</view>
				<!-- <view class="list_btn" v-if="item.status==1">
					<text class="btn1" @click="shoukuanBtn(index)">收款账户</text>
					<text class="btn1" @click="auditReject(item.id)">审核拒绝</text>
					<text class="btn2" @click="approvedBtn(item.id)">审核通过</text>
				</view> -->
			</view>
			<view class="mall_loading" v-if="list.length">
				<u-loadmore :status="status" color='#999' />
			</view>
		</view>
		<!-- 底部 -->
		<BottomBtn title='我要提现' @submit='qutixianBtn' v-if="id==''"></BottomBtn>
	</view>
</template>

<script>
	import BottomBtn from '@/components/bottom_btn/bottom_btn.vue';
	export default {
		components:{
			BottomBtn
		},
		data() {
			return {
				status: 'loadmore', //加载前值为loadmore，加载中为loading，没有数据为nomore
				page: 1,
				list: [],
				// 
				money:'',
				id:'',
			};
		},
		onLoad(opt) {
			if(opt.money){
				this.money=opt.money
			}
			if(opt.id){
				this.id=opt.id
			}
		},
		onShow() {
			this.page=1
			this.getList()
		},
		methods:{
			qutixianBtn(){
				uni.navigateTo({
					url:'/pages/shop/withdrawal?money='+this.money
				})
			},
			// 列表
			getList() {
				var that = this
				if(that.page==1){
					that.$tips.showLoading('加载中')
				}else{
					that.status = 'loading'
				}
				var params = {
					page:that.page,
					user_id:this.id,
				}
				that.$httpApi.userWithdrawcashIndex(params).then((res) => {
					if (res.code == 1) {
						if (that.page == 1) {
							that.list = []
							that.$tips.hideLoading()
						}
						if (res.data.current_page == res.data.last_page) {
							that.status = 'nomore'
						} else {
							that.status = 'loadmore'
						}
						that.list = that.list.concat(res.data.data)
					}
				})
			},
			// 收款账户
			shoukuanBtn(index){
				this.bankInfo={
					name:this.list[index].user.username,
					bank:this.list[index].user.openingbank_name,
					number:this.list[index].user.card_number,
					zfb_img:this.list[index].user.zfb_img,
					wx_image:this.list[index].user.wx_img,
				}
				this.$refs.pay_info.openBtn()
			},
			// 审核拒绝
			auditReject(val){
				uni.navigateTo({
					url:'/pages/person/refuse_msg?id='+val+'&type=3'
				})
			},
			// 审核通过
			approvedBtn(val){
				this.$refs.upPayment.openBtn(val,3)
			},
			submitBtn(){
				this.page=1
				this.getList()
			},
		},
		onReachBottom() {
			if (this.status == 'nomore' || this.status == 'loading') {
				return
			}
			this.page++
			this.getList()
		},
	}
</script>

<style lang="less">
	.withdrawal_details{
		width: 100%;
		padding-top: 24rpx;
		.list{
			width: 100%;
			margin-bottom: 24rpx;
			background: #fff;
			.title{
				width: 100%;
				line-height: 88rpx;
				padding: 0 32rpx;
				border-bottom: 2rpx solid #f7f8fa;
				display: flex;
				align-items: center;
				justify-content: space-between;
				.left{
					font-size: 28rpx;
					font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #333333;
					display: flex;
					align-items: center;
				}
				.right{
					font-size: 28rpx;
					font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					display: flex;
					align-items: center;
					.color1{
						color: #FF7432;
					}
					.color2{
						color: #26C281;
					}
					.color3{
						color: #F56C6C;
					}
				}
			}
			.text{
				width: 100%;
				padding: 20rpx 32rpx;
				display: flex;
				flex-wrap: wrap;
				.txt{
					width: 50%;
					margin-bottom: 20rpx;
				}
			}
			.list_btn{
				width: 100%;
				padding: 20rpx 32rpx;
				border-top: 2rpx solid #f7f8fa;
				display: flex;
				justify-content: flex-end;
				text{
					margin-left: 12rpx;
					display: block;
					padding: 0 20rpx;
					height: 64rpx;
					line-height: 60rpx;
					border-radius: 32rpx;
					font-size: 28rpx;
					font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
				}
				.btn1{
					color: #999;
					border: 2rpx solid #EBEBEB;
				}
				.btn2{
					color: #26C281;
					border: 2rpx solid #26C281;
				}
			}
		}
	}
</style>
